package com.ojoin.trade.common_core.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.utils.LogUtils;
import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.common.web.service.impl.BaseServiceImpl;
import com.ojoin.trade.common_core.web.dao.TbAreaDao;
import com.ojoin.trade.common_core.web.domain.TbArea;
import com.ojoin.trade.common_core.web.service.AreaBaseService;

@Service
public class AreaBaseServiceImpl extends BaseServiceImpl<TbArea> implements
		AreaBaseService {

	@Autowired
	private TbAreaDao dao;
	
	@Override
	protected BaseDao<TbArea> getBaseDao() {
		return dao;
	}

	@Cacheable(value = "enumCache",key="#root.methodName")
	@Override
	public List<TbArea> queryProvinceList() throws BusinessException {
		LogUtils.getT0loanLog().info("查询所有省份列表.");
		return ((TbAreaDao) this
				.getBaseDao()).queryProvinceList();
	}

	@Cacheable(value = "enumCache",key="#parentid")
	@Override
	public List<TbArea> queryCity(String parentid) throws BusinessException {
		LogUtils.getT0loanLog().info("查询省份->" + parentid +"下所有城市列表.");
		return ((TbAreaDao) this
				.getBaseDao()).queryCity(parentid);
	}

}
